package com.feng.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.feng.entity.User;
import com.feng.service.ServletUser;
import com.feng.util.web.ServletUtil;

public class croppic extends HttpServlet {


	private static final long serialVersionUID = 1L;

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		String x = request.getParameter("x");
		String x2 = request.getParameter("x2");
		String y = request.getParameter("y");
		String y2 = request.getParameter("y2");
		
		HttpSession session = request.getSession();
		String path = (String) session.getAttribute("userpicpath");
		User user = (User) session.getAttribute("user");
		
		new ServletUser().changePic(user,path,x,x2,y,y2);
		
		session.removeAttribute("userpicpath");
		
		ServletUtil.redirect(response, "userinfo.jspx");
		
	}

}
